#include "stdafx.h"
#include "Mime.h"
#include <map>
using namespace std;

map<string,string> Mime::c_mmapMime;

string Mime::ext2mime(const string &ext){
	if(c_mmapMime.empty()){
		mimeinit();
	}
	map<string,string>::iterator it = c_mmapMime.find(ext);
	if(it==c_mmapMime.end()){
		return "";
	}
	return (*it).second;
}
void Mime::mimeinit(){
	c_mmapMime["asx"] = "video/x-ms-asf";
	c_mmapMime["xml"] = "text/xml";
	c_mmapMime["tsv"] = "text/tab-separated-values";
	c_mmapMime["ra"] = "audio/x-pn-realaudio";
	c_mmapMime["sv4crc"] = "application/x-sv4crc";
	c_mmapMime["spc"] = "application/x-pkcs7-certificates";
	c_mmapMime["pmc"] = "application/x-perfmon";
	c_mmapMime["lit"] = "application/x-ms-reader";
	c_mmapMime["crd"] = "application/x-mscardfile";
	c_mmapMime["isp"] = "application/x-internet-signup";
	c_mmapMime["wmlsc"] = "application/vnd.wap.wmlscriptc";
	c_mmapMime["vst"] = "application/vnd.visio";
	c_mmapMime["xlam"] = "application/vnd.ms-excel.addin.macroEnabled.12";
	c_mmapMime["ttf"] = "application/octet-stream";
	c_mmapMime["pfm"] = "application/octet-stream";
	c_mmapMime["csv"] = "application/octet-stream";
	c_mmapMime["aaf"] = "application/octet-stream";
	c_mmapMime["one"] = "application/onenote";
	c_mmapMime["hta"] = "application/hta";
	c_mmapMime["atom"] = "application/atom+xml";
	c_mmapMime["323"] = "text/h323";
	c_mmapMime["mhtml"] = "message/rfc822";
	c_mmapMime["midi"] = "audio/mid";
	c_mmapMime["p7r"] = "application/x-pkcs7-certreqresp";
	c_mmapMime["mny"] = "application/x-msmoney";
	c_mmapMime["clp"] = "application/x-msclip";
	c_mmapMime["vsd"] = "application/vnd.visio";
	c_mmapMime["lpk"] = "application/octet-stream";
	c_mmapMime["bin"] = "application/octet-stream";
	c_mmapMime["onetoc"] = "application/onenote";
	c_mmapMime["x"] = "application/directx";
	c_mmapMime["wvx"] = "video/x-ms-wvx";
	c_mmapMime["vcf"] = "text/x-vcard";
	c_mmapMime["htc"] = "text/x-component";
	c_mmapMime["htt"] = "text/webviewhtml";
	c_mmapMime["h"] = "text/plain";
	c_mmapMime["mht"] = "message/rfc822";
	c_mmapMime["mid"] = "audio/mid";
	c_mmapMime["p7b"] = "application/x-pkcs7-certificates";
	c_mmapMime["gz"] = "application/x-gzip";
	c_mmapMime["dvi"] = "application/x-dvi";
	c_mmapMime["cpio"] = "application/x-cpio";
	c_mmapMime["vdx"] = "application/vnd.ms-visio.viewer";
	c_mmapMime["sldm"] = "application/vnd.ms-powerpoint.slide.macroEnabled.12";
	c_mmapMime["xlm"] = "application/vnd.ms-excel";
	c_mmapMime["fdf"] = "application/vnd.fdf";
	c_mmapMime["setreg"] = "application/set-registration-initiation";
	c_mmapMime["eps"] = "application/postscript";
	c_mmapMime["p7s"] = "application/pkcs7-signature";
	c_mmapMime["toc"] = "application/octet-stream";
	c_mmapMime["mdp"] = "application/octet-stream";
	c_mmapMime["ics"] = "application/octet-stream";
	c_mmapMime["chm"] = "application/octet-stream";
	c_mmapMime["asi"] = "application/octet-stream";
	c_mmapMime["afm"] = "application/octet-stream";
	c_mmapMime["evy"] = "application/envoy";
	c_mmapMime["wmp"] = "video/x-ms-wmp";
	c_mmapMime["qt"] = "video/quicktime";
	c_mmapMime["mpv2"] = "video/mpeg";
	c_mmapMime["xslt"] = "text/xml";
	c_mmapMime["etx"] = "text/x-setext";
	c_mmapMime["cod"] = "image/cis-cod";
	c_mmapMime["snd"] = "audio/basic";
	c_mmapMime["au"] = "audio/basic";
	c_mmapMime["man"] = "application/x-troff-man";
	c_mmapMime["qtl"] = "application/x-quicktimeplayer";
	c_mmapMime["pmw"] = "application/x-perfmon";
	c_mmapMime["class"] = "application/x-java-applet";
	c_mmapMime["iii"] = "application/x-iphone";
	c_mmapMime["csh"] = "application/x-csh";
	c_mmapMime["z"] = "application/x-compress";
	c_mmapMime["vtx"] = "application/vnd.visio";
	c_mmapMime["vsw"] = "application/vnd.visio";
	c_mmapMime["wps"] = "application/vnd.ms-works";
	c_mmapMime["potx"] = "application/vnd.openxmlformats-officedocument.presentationml.template";
	c_mmapMime["ps"] = "application/postscript";
	c_mmapMime["p7c"] = "application/pkcs7-mime";
	c_mmapMime["thn"] = "application/octet-stream";
	c_mmapMime["mso"] = "application/octet-stream";
	c_mmapMime["dot"] = "application/msword";
	c_mmapMime["doc"] = "application/msword";
	c_mmapMime["sgml"] = "text/sgml";
	c_mmapMime["nws"] = "message/rfc822";
	c_mmapMime["pbm"] = "image/x-portable-bitmap";
	c_mmapMime["ief"] = "image/ief";
	c_mmapMime["wav"] = "audio/wav";
	c_mmapMime["texi"] = "application/x-texinfo";
	c_mmapMime["mvb"] = "application/x-msmediaview";
	c_mmapMime["hdf"] = "application/x-hdf";
	c_mmapMime["vsx"] = "application/vnd.visio";
	c_mmapMime["dotm"] = "application/vnd.ms-word.template.macroEnabled.12";
	c_mmapMime["docm"] = "application/vnd.ms-word.document.macroEnabled.12";
	c_mmapMime["pptx"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
	c_mmapMime["psm"] = "application/octet-stream";
	c_mmapMime["java"] = "application/octet-stream";
	c_mmapMime["eot"] = "application/octet-stream";
	c_mmapMime["jar"] = "application/java-archive";
	c_mmapMime["mpeg"] = "video/mpeg";
	c_mmapMime["xsf"] = "text/xml";
	c_mmapMime["map"] = "text/plain";
	c_mmapMime["uls"] = "text/iuls";
	c_mmapMime["rf"] = "image/vnd.rn-realflash";
	c_mmapMime["m3u"] = "audio/x-mpegurl";
	c_mmapMime["wma"] = "audio/x-ms-wma";
	c_mmapMime["aifc"] = "audio/aiff";
	c_mmapMime["mdb"] = "application/x-msaccess";
	c_mmapMime["mvc"] = "application/x-miva-compiled";
	c_mmapMime["stl"] = "application/vnd.ms-pki.stl";
	c_mmapMime["ppsx"] = "application/vnd.openxmlformats-officedocument.presentationml.slideshow";
	c_mmapMime["xlsb"] = "application/vnd.ms-excel.sheet.binary.macroEnabled.12";
	c_mmapMime["setpay"] = "application/set-payment-initiation";
	c_mmapMime["prm"] = "application/octet-stream";
	c_mmapMime["mix"] = "application/octet-stream";
	c_mmapMime["lzh"] = "application/octet-stream";
	c_mmapMime["hhk"] = "application/octet-stream";
	c_mmapMime["onepkg"] = "application/onenote";
	c_mmapMime["xaf"] = "x-world/x-vrml";
	c_mmapMime["flr"] = "x-world/x-vrml";
	c_mmapMime["IVF"] = "video/x-ivf";
	c_mmapMime["cnf"] = "text/plain";
	c_mmapMime["asm"] = "text/plain";
	c_mmapMime["tiff"] = "image/tiff";
	c_mmapMime["wax"] = "audio/x-ms-wax";
	c_mmapMime["ms"] = "application/x-troff-ms";
	c_mmapMime["tcl"] = "application/x-tcl";
	c_mmapMime["shar"] = "application/x-shar";
	c_mmapMime["sh"] = "application/x-sh";
	c_mmapMime["nc"] = "application/x-netcdf";
	c_mmapMime["hlp"] = "application/winhlp";
	c_mmapMime["oda"] = "application/oda";
	c_mmapMime["pfb"] = "application/octet-stream";
	c_mmapMime["fla"] = "application/octet-stream";
	c_mmapMime["wm"] = "video/x-ms-wm";
	c_mmapMime["rgb"] = "image/x-rgb";
	c_mmapMime["ppm"] = "image/x-portable-pixmap";
	c_mmapMime["ram"] = "audio/x-pn-realaudio";
	c_mmapMime["sit"] = "application/x-stuffit";
	c_mmapMime["dir"] = "application/x-director";
	c_mmapMime["mpp"] = "application/vnd.ms-project";
	c_mmapMime["xla"] = "application/vnd.ms-excel";
	c_mmapMime["ssm"] = "application/streamingmedia";
	c_mmapMime["axs"] = "application/olescript";
	c_mmapMime["ods"] = "application/oleobject";
	c_mmapMime["psp"] = "application/octet-stream";
	c_mmapMime["jpb"] = "application/octet-stream";
	c_mmapMime["wrz"] = "x-world/x-vrml";
	c_mmapMime["m1v"] = "video/mpeg";
	c_mmapMime["mno"] = "text/xml";
	c_mmapMime["cmx"] = "image/x-cmx";
	c_mmapMime["jpeg"] = "image/jpeg";
	c_mmapMime["dib"] = "image/bmp";
	c_mmapMime["rmi"] = "audio/mid";
	c_mmapMime["aiff"] = "audio/aiff";
	c_mmapMime["wmd"] = "application/x-ms-wmd";
	c_mmapMime["wri"] = "application/x-mswrite";
	c_mmapMime["pub"] = "application/x-mspublisher";
	c_mmapMime["ins"] = "application/x-internet-signup";
	c_mmapMime["wks"] = "application/vnd.ms-works";
	c_mmapMime["xls"] = "application/vnd.ms-excel";
	c_mmapMime["ai"] = "application/postscript";
	c_mmapMime["crl"] = "application/pkix-crl";
	c_mmapMime["qxd"] = "application/octet-stream";
	c_mmapMime["dwp"] = "application/octet-stream";
	c_mmapMime["xof"] = "x-world/x-vrml";
	c_mmapMime["wmv"] = "video/x-ms-wmv";
	c_mmapMime["nsc"] = "video/x-ms-asf";
	c_mmapMime["mpa"] = "video/mpeg";
	c_mmapMime["pnm"] = "image/x-portable-anymap";
	c_mmapMime["rpm"] = "audio/x-pn-realaudio-plugin";
	c_mmapMime["aif"] = "audio/x-aiff";
	c_mmapMime["me"] = "application/x-troff-me";
	c_mmapMime["pml"] = "application/x-perfmon";
	c_mmapMime["trm"] = "application/x-msterminal";
	c_mmapMime["m13"] = "application/x-msmediaview";
	c_mmapMime["js"] = "application/x-javascript";
	c_mmapMime["dxr"] = "application/x-director";
	c_mmapMime["potm"] = "application/vnd.ms-powerpoint.template.macroEnabled.12";
	c_mmapMime["xltx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.template";
	c_mmapMime["xlt"] = "application/vnd.ms-excel";
	c_mmapMime["xlc"] = "application/vnd.ms-excel";
	c_mmapMime["p10"] = "application/pkcs10";
	c_mmapMime["smi"] = "application/octet-stream";
	c_mmapMime["sea"] = "application/octet-stream";
	c_mmapMime["hqx"] = "application/mac-binhex40";
	c_mmapMime["spl"] = "application/futuresplash";
	c_mmapMime["movie"] = "video/x-sgi-movie";
	c_mmapMime["lsf"] = "video/x-la-asf";
	c_mmapMime["txt"] = "text/plain";
	c_mmapMime["jfif"] = "image/pjpeg";
	c_mmapMime["jpe"] = "image/jpeg";
	c_mmapMime["zip"] = "application/x-zip-compressed";
	c_mmapMime["wmf"] = "application/x-msmetafile";
	c_mmapMime["m14"] = "application/x-msmediaview";
	c_mmapMime["latex"] = "application/x-latex";
	c_mmapMime["wcm"] = "application/vnd.ms-works";
	c_mmapMime["pptm"] = "application/vnd.ms-powerpoint.presentation.macroEnabled.12";
	c_mmapMime["xlsx"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
	c_mmapMime["hhp"] = "application/octet-stream";
	c_mmapMime["aca"] = "application/octet-stream";
	c_mmapMime["accdb"] = "application/msaccess";
	c_mmapMime["jcz"] = "application/liquidmotion";
	c_mmapMime["wrl"] = "x-world/x-vrml";
	c_mmapMime["wmx"] = "video/x-ms-wmx";
	c_mmapMime["asr"] = "video/x-ms-asf";
	c_mmapMime["lsx"] = "video/x-la-asf";
	c_mmapMime["xsl"] = "text/xml";
	c_mmapMime["html"] = "text/html";
	c_mmapMime["tif"] = "image/tiff";
	c_mmapMime["der"] = "application/x-x509-ca-cert";
	c_mmapMime["pfx"] = "application/x-pkcs12";
	c_mmapMime["p12"] = "application/x-pkcs12";
	c_mmapMime["ppsm"] = "application/vnd.ms-powerpoint.slideshow.macroEnabled.12";
	c_mmapMime["cur"] = "application/octet-stream";
	c_mmapMime["accdt"] = "application/msaccess";
	c_mmapMime["hdml"] = "text/x-hdml";
	c_mmapMime["htm"] = "text/html";
	c_mmapMime["xbm"] = "image/x-xbitmap";
	c_mmapMime["jpg"] = "image/jpeg";
	c_mmapMime["texinfo"] = "application/x-texinfo";
	c_mmapMime["ppam"] = "application/vnd.ms-powerpoint.addin.macroEnabled.12";
	c_mmapMime["xlw"] = "application/vnd.ms-excel";
	c_mmapMime["rm"] = "application/vnd.rn-realmedia";
	c_mmapMime["pdf"] = "application/pdf";
	c_mmapMime["rar"] = "application/octet-stream";
	c_mmapMime["psd"] = "application/octet-stream";
	c_mmapMime["inf"] = "application/octet-stream";
	c_mmapMime["emz"] = "application/octet-stream";
	c_mmapMime["dsp"] = "application/octet-stream";
	c_mmapMime["onea"] = "application/onenote";
	c_mmapMime["jck"] = "application/liquidmotion";
	c_mmapMime["mpe"] = "video/mpeg";
	c_mmapMime["mp2"] = "video/mpeg";
	c_mmapMime["sct"] = "text/scriptlet";
	c_mmapMime["ras"] = "image/x-cmu-raster";
	c_mmapMime["swf"] = "application/x-shockwave-flash";
	c_mmapMime["wmz"] = "application/x-ms-wmz";
	c_mmapMime["gtar"] = "application/x-gtar";
	c_mmapMime["dcr"] = "application/x-director";
	c_mmapMime["sldx"] = "application/vnd.openxmlformats-officedocument.presentationml.slide";
	c_mmapMime["pps"] = "application/vnd.ms-pps";
	c_mmapMime["p7m"] = "application/pkcs7-mime";
	c_mmapMime["xsn"] = "application/octet-stream";
	c_mmapMime["ocx"] = "application/octet-stream";
	c_mmapMime["accde"] = "application/msaccess";
	c_mmapMime["mov"] = "video/quicktime";
	c_mmapMime["wmls"] = "text/vnd.wap.wmlscript";
	c_mmapMime["cpp"] = "text/plain";
	c_mmapMime["c"] = "text/plain";
	c_mmapMime["bas"] = "text/plain";
	c_mmapMime["css"] = "text/css";
	c_mmapMime["art"] = "image/x-jg";
	c_mmapMime["mp3"] = "audio/mpeg";
	c_mmapMime["t"] = "application/x-troff";
	c_mmapMime["roff"] = "application/x-troff";
	c_mmapMime["tar"] = "application/x-tar";
	c_mmapMime["hhc"] = "application/x-oleobject";
	c_mmapMime["scd"] = "application/x-msschedule";
	c_mmapMime["pko"] = "application/vnd.ms-pki.pko";
	c_mmapMime["sst"] = "application/vnd.ms-pki.certstore";
	c_mmapMime["ppt"] = "application/vnd.ms-powerpoint";
	c_mmapMime["xtp"] = "application/octet-stream";
	c_mmapMime["u32"] = "application/octet-stream";
	c_mmapMime["pcx"] = "application/octet-stream";
	c_mmapMime["msi"] = "application/octet-stream";
	c_mmapMime["exe"] = "application/octet-stream";
	c_mmapMime["asd"] = "application/octet-stream";
	c_mmapMime["onetoc2"] = "application/onenote";
	c_mmapMime["fif"] = "application/fractals";
	c_mmapMime["mpg"] = "video/mpeg";
	c_mmapMime["vml"] = "text/xml";
	c_mmapMime["xdr"] = "text/plain";
	c_mmapMime["vcs"] = "text/plain";
	c_mmapMime["hxt"] = "text/html";
	c_mmapMime["eml"] = "message/rfc822";
	c_mmapMime["xpm"] = "image/x-xpixmap";
	c_mmapMime["ico"] = "image/x-icon";
	c_mmapMime["gif"] = "image/gif";
	c_mmapMime["dwf"] = "drawing/x-dwf";
	c_mmapMime["src"] = "application/x-wais-source";
	c_mmapMime["tr"] = "application/x-troff";
	c_mmapMime["pmr"] = "application/x-perfmon";
	c_mmapMime["pma"] = "application/x-perfmon";
	c_mmapMime["dll"] = "application/x-msdownload";
	c_mmapMime["bcpio"] = "application/x-bcpio";
	c_mmapMime["wmlc"] = "application/vnd.wap.wmlc";
	c_mmapMime["wdb"] = "application/vnd.ms-works";
	c_mmapMime["dotx"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.template";
	c_mmapMime["docx"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
	c_mmapMime["pot"] = "application/vnd.ms-powerpoint";
	c_mmapMime["xltm"] = "application/vnd.ms-excel.template.macroEnabled.12";
	c_mmapMime["rtf"] = "application/rtf";
	c_mmapMime["prf"] = "application/pics-rules";
	c_mmapMime["snp"] = "application/octet-stream";
	c_mmapMime["cab"] = "application/octet-stream";
	c_mmapMime["avi"] = "video/x-msvideo";
	c_mmapMime["asf"] = "video/x-ms-asf";
	c_mmapMime["dtd"] = "text/xml";
	c_mmapMime["wml"] = "text/vnd.wap.wml";
	c_mmapMime["vbs"] = "text/vbscript";
	c_mmapMime["rtx"] = "text/richtext";
	c_mmapMime["dlm"] = "text/dlm";
	c_mmapMime["xwd"] = "image/x-xwindowdump";
	c_mmapMime["pgm"] = "image/x-portable-graymap";
	c_mmapMime["bmp"] = "image/bmp";
	c_mmapMime["crt"] = "application/x-x509-ca-cert";
	c_mmapMime["ustar"] = "application/x-ustar";
	c_mmapMime["tex"] = "application/x-tex";
	c_mmapMime["sv4cpio"] = "application/x-sv4cpio";
	c_mmapMime["tgz"] = "application/x-compressed";
	c_mmapMime["cdf"] = "application/x-cdf";
	c_mmapMime["vss"] = "application/vnd.visio";
	c_mmapMime["cat"] = "application/vnd.ms-pki.seccat";
	c_mmapMime["thmx"] = "application/vnd.ms-officetheme";
	c_mmapMime["xlsm"] = "application/vnd.ms-excel.sheet.macroEnabled.12";
	c_mmapMime["prx"] = "application/octet-stream";
	c_mmapMime["pcz"] = "application/octet-stream";
	c_mmapMime["onetmp"] = "application/onenote";
	c_mmapMime["acx"] = "application/internet-property-stream";
	c_mmapMime["wsdl"] = "text/xml";
	c_mmapMime["disco"] = "text/xml";
	c_mmapMime["xsd"] = "text/xml";
	c_mmapMime["wbmp"] = "image/vnd.wap.wbmp";
	c_mmapMime["png"] = "image/png";
	c_mmapMime["pnz"] = "image/png";
	c_mmapMime["smd"] = "audio/x-smd";
	c_mmapMime["smz"] = "audio/x-smd";
	c_mmapMime["smx"] = "audio/x-smd";
	c_mmapMime["mmf"] = "application/x-smaf";
}
